package com.delos.rbac.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.delos.rbac.entity.RoleResourceDO;
import com.delos.rbac.mapper.RoleResourceMapper;
import com.delos.rbac.service.IRoleResource;
import org.springframework.stereotype.Service;

import java.util.HashSet;
import java.util.Set;

/**
 * @author zouyaowen
 * @date 2020-06-28
 */
@Service
public class RoleResourceImpl extends ServiceImpl<RoleResourceMapper, RoleResourceDO> implements IRoleResource {

    @Override
    public Set<RoleResourceDO> getByResourceId(Long resourceId) {
        QueryWrapper<RoleResourceDO> query = new QueryWrapper<>();
        query.eq("resource_id", resourceId);
        return new HashSet<>(this.baseMapper.selectList(query));
    }
}

